<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>object</title>
  <script>
    window.onload = function () {
      var p = {
        name: 'foo',
        age: 12,
        nickName: 'bar',
        setName: function (name) {
          this.name = name
        },
        setAge: function (age) {
          this.age = age
        }
      }
      console.log(p.name, p.setName, p.nickName)
    }
  </script>
</head>
<body>

</body>
</html>